<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2006-2016 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU libgomp: OpenACC Runtime Library Routines</title>

<meta name="description" content="GNU libgomp: OpenACC Runtime Library Routines">
<meta name="keywords" content="GNU libgomp: OpenACC Runtime Library Routines">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Library-Index.html#Library-Index" rel="index" title="Library Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="acc_005fget_005fnum_005fdevices.html#acc_005fget_005fnum_005fdevices" rel="next" title="acc_get_num_devices">
<link href="Enabling-OpenACC.html#Enabling-OpenACC" rel="prev" title="Enabling OpenACC">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="OpenACC-Runtime-Library-Routines"></a>
<div class="header">
<p>
Next: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="n" rel="next">OpenACC Environment Variables</a>, Previous: <a href="Enabling-OpenACC.html#Enabling-OpenACC" accesskey="p" rel="prev">Enabling OpenACC</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html#Library-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="OpenACC-Runtime-Library-Routines-1"></a>
<h2 class="chapter">5 OpenACC Runtime Library Routines</h2>

<p>The runtime routines described here are defined by section 3 of the OpenACC
specifications in version 2.0.
They have C linkage, and do not throw exceptions.
Generally, they are available only for the host, with the exception of
<code>acc_on_device</code>, which is available for both the host and the
acceleration device.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fnum_005fdevices.html#acc_005fget_005fnum_005fdevices" accesskey="1">acc_get_num_devices</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get number of devices for the given device
                                type.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fdevice_005ftype.html#acc_005fset_005fdevice_005ftype" accesskey="2">acc_set_device_type</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set type of device accelerator to use.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fdevice_005ftype.html#acc_005fget_005fdevice_005ftype" accesskey="3">acc_get_device_type</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get type of device accelerator to be used.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fdevice_005fnum.html#acc_005fset_005fdevice_005fnum" accesskey="4">acc_set_device_num</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set device number to use.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fdevice_005fnum.html#acc_005fget_005fdevice_005fnum" accesskey="5">acc_get_device_num</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get device number to be used.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fasync_005ftest.html#acc_005fasync_005ftest" accesskey="6">acc_async_test</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tests for completion of a specific asynchronous
                                operation.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fasync_005ftest_005fall.html#acc_005fasync_005ftest_005fall" accesskey="7">acc_async_test_all</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tests for completion of all asychronous
                                operations.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fwait.html#acc_005fwait" accesskey="8">acc_wait</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of a specific asynchronous
                                operation.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fall.html#acc_005fwait_005fall" accesskey="9">acc_wait_all</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Waits for completion of all asyncrhonous
                                operations.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fall_005fasync.html#acc_005fwait_005fall_005fasync">acc_wait_all_async</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of all asynchronous
                                operations.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fasync.html#acc_005fwait_005fasync">acc_wait_async</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of asynchronous operations.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005finit.html#acc_005finit">acc_init</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Initialize runtime for a specific device type.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fshutdown.html#acc_005fshutdown">acc_shutdown</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Shuts down the runtime for a specific device
                                type.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fon_005fdevice.html#acc_005fon_005fdevice">acc_on_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Whether executing on a particular device
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fmalloc.html#acc_005fmalloc">acc_malloc</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005ffree.html#acc_005ffree">acc_free</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Free device memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fcopyin.html#acc_005fcopyin">acc_copyin</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory and copy host memory to
                                it.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fpresent_005for_005fcopyin.html#acc_005fpresent_005for_005fcopyin">acc_present_or_copyin</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">If the data is not present on the device,
                                allocate device memory and copy from host
                                memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fcreate.html#acc_005fcreate">acc_create</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory and map it to host
                                memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fpresent_005for_005fcreate.html#acc_005fpresent_005for_005fcreate">acc_present_or_create</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">If the data is not present on the device,
                                allocate device memory and map it to host
                                memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fcopyout.html#acc_005fcopyout">acc_copyout</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy device memory to host memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fdelete.html#acc_005fdelete">acc_delete</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Free device memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fupdate_005fdevice.html#acc_005fupdate_005fdevice">acc_update_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Update device memory from mapped host memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fupdate_005fself.html#acc_005fupdate_005fself">acc_update_self</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Update host memory from mapped device memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fmap_005fdata.html#acc_005fmap_005fdata">acc_map_data</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Map previously allocated device memory to host
                                memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005funmap_005fdata.html#acc_005funmap_005fdata">acc_unmap_data</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Unmap device memory from host memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fdeviceptr.html#acc_005fdeviceptr">acc_deviceptr</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get device pointer associated with specific
                                host address.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fhostptr.html#acc_005fhostptr">acc_hostptr</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get host pointer associated with specific
                                device address.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fis_005fpresent.html#acc_005fis_005fpresent">acc_is_present</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Indiciate whether host variable / array is
                                present on device.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fmemcpy_005fto_005fdevice.html#acc_005fmemcpy_005fto_005fdevice">acc_memcpy_to_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy host memory to device memory.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fmemcpy_005ffrom_005fdevice.html#acc_005fmemcpy_005ffrom_005fdevice">acc_memcpy_from_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy device memory to host memory.
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
API routines for target platforms.

</pre></th></tr><tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcurrent_005fcuda_005fdevice.html#acc_005fget_005fcurrent_005fcuda_005fdevice">acc_get_current_cuda_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA device handle.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcurrent_005fcuda_005fcontext.html#acc_005fget_005fcurrent_005fcuda_005fcontext">acc_get_current_cuda_context</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA context handle.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcuda_005fstream.html#acc_005fget_005fcuda_005fstream">acc_get_cuda_stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA stream handle.
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fcuda_005fstream.html#acc_005fset_005fcuda_005fstream">acc_set_cuda_stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set CUDA stream handle.
</td></tr>
</table>



<hr>
<div class="header">
<p>
Next: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="n" rel="next">OpenACC Environment Variables</a>, Previous: <a href="Enabling-OpenACC.html#Enabling-OpenACC" accesskey="p" rel="prev">Enabling OpenACC</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html#Library-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
